package net.mm.base.helper;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * 
 * @author ZZH
 * 
 */
public final class FileHelper {

	/**
	 * 文件复制
	 * 
	 * @param in
	 *            inputStream
	 * @param out
	 *            outputStream
	 * @return true成功 false失败
	 */
	public static boolean copy(InputStream in, OutputStream out) {

		boolean bool = Boolean.TRUE;
		try {
			byte[] bytes = new byte[1024];
			int len = 0;
			while ((len = in.read(bytes)) != -1) {
				out.write(bytes, 0, len);
			}
			out.close();
			in.close();
		} catch (Exception e) {
			// TODO: handle exception
			System.out.println(e.getMessage());
			bool = Boolean.FALSE;
		}
		return bool;
	}
}
